<template>
  <div class="savevisit-chart" ref="charts" />
</template>

<script>
import * as echarts from 'echarts'
import resize from '@/mixin/resize'

export default {
  name: 'SaveVisitChart',
  mixins: [resize],
  mounted() {
    const myEcharts = echarts.init(this.$refs.charts)
    myEcharts.setOption({
      title: {
        text: '销售额趋势',
        textStyle: {
          fontSize: 14
        },
        top: '5%'
      },
      grid: {
        top: '20%',
        bottom: '7%',
        right: '40',
        left: '60',
        containerLabel: true
      },
      xAxis: {
        // isshow: false,
        data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
      },
      yAxis: {},
      series: {
        name: '销售量',
        type: 'bar',
        data: [
          120,
          100,
          40,
          130,
          180,
          110,
          30,
          70,
          100,
          60,
          190,
          160,
          140,
          90,
          20,
          40
        ],
        barWidth: 30
      },
      tooltip: {
        show: true,
        trigger: 'axis',
        axisPointer: {
          show: true,
          type: 'line',
          lineStyle: {
            width: 50,
            color: 'rgba(0, 0, 0, 0.1)'
          }
        }
      }
    })
    this.myEcharts = myEcharts
  }
}
</script>

<style lang="scss" scoped>
.savevisit-chart {
  width: 100%;
  // height: 300px;
  height: 100%;
}
</style>
